import Vue from 'vue'
import Router from 'vue-router'
import { Lazyload } from 'vant';

Vue.use(Router)
Vue.use(Lazyload);
let router= new Router({
  routes: [
    {
      path: '/',
      name: 'HelloWorld',
      redirect:'index',
      component: ()=>import('@/components/HelloWorld'),
      meta:{
        title:'首页'
      }
    },
    {
      path:'/offlineact',
      name:'offlineact',
      component: ()=>import('@/views/Offlineact'),
    },
   
    {
      path:'/videobuy',
      name:'videobuy',
      component: ()=>import('@/views/Videobuy'),
    },{
      path: '/login',
      name: 'login',
      meta:{
        title:'登录'
      },
      component: ()=>import('@/views/Login')
           },
           {
            path: '/register',
            name: 'register',
            meta:{
            title:'注册'
            },
            component: ()=>import('@/views/Register')
            },
            
    {
      path:'/message',
      name:'message',
      component: ()=>import('@/views2/Message'),
    },
    {
      path:'/sign',
      name:'sign',
      component: ()=>import('@/views/Sign'),
    },
    {
			path:'/setting',
			name:'setting',
			component: () => import('@/views/Setting'),
			meta: {
			  title: '设置'
			}
    },
    {
			path:'/settingafter',
			name:'settingafter',
			component:()=>import('@/views/Settingafter'),
			meta: {
			  title: '设置2'
			}
    },
    {
			path:'/uppwd',
			name:'uppwd',
			component:()=>import('@/views/Uppwd'),
			meta: {
			  title: '修改密码'
			}
		},
		{
			path:'/upuser',
			name:'upuser',
			component:()=>import('@/views/Upuser'),
			meta: {
			  title: '修改用户名'
			}
		},
		{
			path:'/looklive',
			name:'looklive',
			component:()=>import('@/views/Looklive'),
			meta: {
			  title: '看直播'
			}
		},
		{
			path:'/orders/:id',
			name:'orders',
			component:()=>import('@/views/Orders'),
			meta: {
			  title: '订单中心'
			}
		},
		{
			path:'/gift',
			name:'gift',
			component:()=>import('@/views/Gift'),
			meta: {
			  title: '礼品卡'
			}
		},
		{
			path:'/credit',
			name:'credit',
			component:()=>import('@/views/Credit'),
			meta: {
			  title: '积分'
			}
		},
		{
			path:'/coupon',
			name:'coupon',
			component:()=>import('@/views/Coupon'),
			meta: {
			  title: '抵用券'
			}
		},
		{
			path:'/advance',
			name:'advance',
			component:()=>import('@/views/Advance'),
			meta: {
			  title: '预付款'
			}
		},
		{
			path:'/oudian',
			name:'oudian',
			component:()=>import('@/views/Oudian'),
			meta: {
			  title: '鸥点'
			}
		},
		{
			path:'/bookmark',
			name:'bookmark',
			component:()=>import('@/views/Bookmark'),
			meta: {
			  title: '收藏'
			}
		},
		{
			path:'/giftconpon',
			name:'giftconpon',
			component:()=>import('@/views/Giftconpon'),
			meta: {
			  title: '礼券兑换'
			}
		},
		{
			path:'/invoices',
			name:'invoices',
			component:()=>import('@/views/Invoices'),
			meta: {
			  title: '发票管理'
			}
		},
		{
			path:'/active',
			name:'active',
			component:()=>import('@/views/Active'),
			meta: {
			  title: '我的活动'
			}
		},
		{
			path:'/bill',
			name:'bill',
			component:()=>import('@/views/Bill'),
			meta: {
			  title: '我的账单'
			}
		},
		{
			path:'/advise',
			name:'advise',
			component:()=>import('@/views/Advise'),
			meta: {
			  title: '建议反馈'
			}
		},
    {
      path:'/detailbenefit',
      name:'detailbenefit',
      component: ()=>import('@/views/Detailbenefit'),
    },
    {
      path:'/assemble',
      name:'assemble',
      component: ()=>import('@/views/Assemble'),
    },
    {
      path:'/newgoods',
      name:'newgoods',
      component: ()=>import('@/views/Newgoods'),
    },
    {
      path:'/classify',
      name:'classify',
      component: ()=>import('@/views2/Classify'),
    },
    {
      path:'/bargain',
      name:'bargain',
      component: ()=>import('@/views/Bargain'),
    },
    {
      path:'/rank',
      name:'rank',
      component: ()=>import('@/views/Rank'),
    },
    {
      path:'/goass/:id',
      name:'goass',
      component: ()=>import('@/views/Goass'),
    },
    {
      path:'/advancesale',
      name:'advancesale',
      component: ()=>import('@/views2/Advancesale'),
    },
    {
      path:'/order',
      name:'order',
      component: ()=>import('@/views/Order'),
    },
    {
      path:'/detailpro/:id',
      name:'detailpro',
      component: ()=>import('@/views/Detailpro'),
    },
    {
      path:'/detailpro1/:id',
      name:'detailpro1',
      component: ()=>import('@/views/Detailpro1'),
    }, {
      path:'/adress',
      name:'adress',
      component: ()=>import('@/views/Adress'),
    },
    {
      path:'/getinfo',
      name:'getinfo',
      component: ()=>import('@/views/Getinfo'),
    },
    {
      path:'/updateadress/:id',
      name:'updateadress',
      component: ()=>import('@/views/Updateadress'),
    },
    
    {
      path:'/cutprice',
      name:'cutprice',
      component: ()=>import('@/views2/Cutprice'),
    },
    {
      path:'/panasonic',
      name:'panasonic',
      component: ()=>import('@/views2/Panasonic'),
    },
    {
      path:'/hottop',
      name:'hottop',
      component: ()=>import('@/views2/Hottop'),
    },
    {
      path:'/nasdi',
      name:'nasdi',
      component: ()=>import('@/views2/Nasdi'),
    },
    {
      path:'/superhealth',
      name:'superhealth',
      component: ()=>import('@/views2/Superhealth'),
    },
    {
      path:'/thatsit1',
      name:'thatsit1',
      component: ()=>import('@/views2/Thatsit1'),
    },
    {
      path:'/thatsit2',
      name:'thatsit2',
      component: ()=>import('@/views2/Thatsit2'),
    },
    {
      path:'/olayshow',
      name:'olayshow',
      component: ()=>import('@/views2/Olayshow'),
    },{
      path: '/detail',
      name: 'detail',
      component: () => import('@/views/Detail'),
    },
    {
      path: '/detail1',
      name: 'detail1',
      component: () => import('@/views/Detail1'),
    },
    {
      path: '/pay',
      name: 'pay',
      component: () => import('@/views/Pay')
    },

    {
      path: '/index',
      name: 'index',
      redirect:'/home',
      meta:{
        title:'首页'
      },
      component: ()=>import('@/views/Index'),
      children:[
        {
          path: '/cart',
          name: 'cart',
          component: ()=>import('@/views/Cart'),
          meta:{
            title:'购物车'
          }
        },
        {
          path: '/sort',
          name: 'sort',
          component: ()=>import('@/views/Sort'),
          meta:{
            title:'分类'
          }
    
        },
        {
          path: '/live',
          name: 'live',
          component: ()=>import('@/views/Live'),
          meta:{
            title:'直播'
          }
        },
        {
          path: '/mine',
          name: 'mine',
          component: ()=>import('@/views/Mine'),
          meta:{
            title:'我的'
          }
        },
        {
          path: '/home',
          name: 'home',
          redirect:'/p1',
          component: ()=>import('@/views/Home'),
          meta:{
            title:'首页'
          },
          children:[
            {
              path:'/p1',
              name:'p1',
              component:()=>import('@/views/P1')
            },
            {
              path:'/p2',
              name:'p2',
              component:()=>import('@/views/P2')
            },
            {
              path:'/p3',
              name:'p3',
              component:()=>import('@/views/P3')
            },
            {
              path:'/p4',
              name:'p4',
              component:()=>import('@/views/P4')
            }
          ]
        },

      ]
    },

  ]
})

router.beforeEach((to,from,next)=>{
  if(to.meta.title){
    document.title=to.meta.title
  }
  next()
})

export default router;
